<?php
/*
 *聊同安
 */
namespace app\comm\service;
use app\comm\service\UserService;
use think\Controller;
use \GatewayWorker\Lib\Gateway;

class WorkService{

	public function __construct(){
		Gateway::$registerAddress="127.0.0.1:1236";
	}

	/**
	 * 发送消息
	 */
	public function sendbyclient($client,$msg){
		 Gateway::sendToClient($client,$msg);
	}

	/**
	 * 绑定uid 
	 */
	public function bindbyuid($client,$uid){
		//$client = request()->get("client");
		//dd($client);
		Gateway::bindUid($client,$uid);
	}

	/**
	 * 发送消息 uid
	 */
	public function sendmsg($touid,$message){
		Gateway::sendToUid($touid, $message);
	}

	/**
	 * 是否在线
	 */
	public function isparonline($touid){
		return Gateway::isUidOnline($touid);
	}

}